package com.rfsp.common.service;

import java.util.Date;
import java.util.List;

import com.rfsp.common.util.BeanUtil;
import com.rfsp.common.pojo.po.OrgPO;
import com.rfsp.common.pojo.vo.OrgVO;
import com.rfsp.mcp.service.ContactService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.rfsp.common.base.BaseService;
import com.rfsp.common.mapper.OrgMapper;

@Service
public class OrgService extends BaseService<OrgPO> {

	public Logger log = LoggerFactory.getLogger(OrgService.class);
	
	@Autowired
	OrgMapper mapper2;
	
	
	public OrgPO getOrgByUserId(Long userId) {
		OrgPO orgPO = new OrgPO();
		
		orgPO = mapper2.getOrgByUserId(userId);
		
		return orgPO;
	}
	
	
	public List<OrgPO> query3() {
		
		List<OrgPO> voList =  super.queryListByIds("1000,1001");
		return voList;
	}
	
	public List<OrgPO> query() {
		
		List<OrgPO> voList =  mapper.select(null);
		return voList;
	}
	
	public List<OrgPO> query2() {
		
		List<OrgPO> voList =  jdbc.queryForList("select * from m_user_org", OrgPO.class);
		return voList;
	}

	public OrgVO getById(Long id){
		OrgPO po=mapper.selectByPrimaryKey(id);
		OrgVO vo=new OrgVO();
		BeanUtil.copyProperties(po,vo);
		return vo;
	}

	public OrgPO findById(Long id){
		return mapper.selectByPrimaryKey(id);
	}
}
